package com.neishenmo.sochatapp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

import com.neishenmo.sochatapp.network.ApiConstract;
import com.neishenmo.sochatapp.network.ApiPresenter;
import com.neishenmo.sochatapp.util.Utils;

import java.util.HashMap;
import java.util.Map;

import okhttp3.MediaType;
import okhttp3.RequestBody;

public class MainActivity extends AppCompatActivity implements ApiConstract.view{

    private ApiPresenter apiPresenter=new ApiPresenter(this);
    private int loadType=1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Map<String,String> map=new HashMap<>();
        map.put("telephone","17600101429");
        map.put("msgCode","123456");

        MediaType JSON = MediaType.parse("application/json; charset=UTF-8");
        RequestBody requestBody = RequestBody.create(JSON, Utils.mapToJson(map));
        apiPresenter.loadRegistUser(requestBody);
    }

    @Override
    public void showErrMsg(String msg) {


    }

    @Override
    public void showInfo(String string) {
        Log.e("成功",string);

    }
}
